const db = wx.cloud.database();

function t(t, e, a) {
    return e in t ? Object.defineProperty(t, e, {
        value: a,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[e] = a, t;
}

var e = getApp(),
    a = require("../../../utils/qqmap-wx-jssdk.min.js"),
    i = require("../../../utils/sensorsdata.min.js"),
    s = void 0;

Page({
    data: {
        faver: [],
        userInfo: {},
        hasUserInfo: !1,
        canIUse: wx.canIUse("button.open-type.getUserInfo"),
        sessionKey: "",
        uid: "",
        goLogin: !1,
        act: 1,
        show_tab_bar: !0,
        page_index: "dsj",
        layer: !0,
        flag: !0,
        region: [{
            letters: "B",
            regionInfo: ["滨州"]
        }, {
            letters: "D",
            regionInfo: ["德州", "东营"]
        }, {
            letters: "H",
            regionInfo: ["菏泽"]
        }, {
            letters: "J",
            regionInfo: ["济南", "济宁"]
        }, {
            letters: "L",
            regionInfo: ["临沂", "聊城"]
        }, {
            letters: "Q",
            regionInfo: ["青岛"]
        }, {
            letters: "S",
            regionInfo: ["省属"]
        }, {
            letters: "W",
            regionInfo: ["潍坊", "威海"]
        }, {
            letters: "T",
            regionInfo: ["泰安"]
        }, {
            letters: "R",
            regionInfo: ["日照"]
        }, {
            letters: "Y",
            regionInfo: ["烟台"]
        }, {
            letters: "Z",
            regionInfo: ["淄博", "枣庄"]
        }],
        scrollHeight: wx.getSystemInfoSync().windowHeight - 140,
        location: "省属",
        top: null,
        lock: !0,
        shadow: !1,
        showJob: !1,
        job: "机关单位",
        jobIndex: null,
        showEdu: !1,
        edu: "进面分数",
        showEdu1: !1,
        edu1: "通过人数",
        eduIndex: null,
        eduList: ["由高到低", "由低到高", "研究生"],
        shownianfen: !1,
        nianfen: "2021",
        nianfenIndex: null,
        nianfenList: ["2018", "2019", "2020", "2021"],
        showMajor: !1,
        major: "专业",
        majorIndex: null,
        majorList: null,
        showMore: !1,
        sort: null,
        jidActive01: 0,
        jidActive02: 0,
        jidActive03: 0,
        midActive01: 0,
        midActive02: 0,
        midActive03: 0,
        zwk_diqu: "",
        zwk_fenlei: "",
        zwk_yrsj: "",
        keyword: "",
        xueli: "",
        xuewei: "",
        zwk_bmmc: "",
        zhuanye: "",
        page: "1",
        zwk_jcnx: "",
        zwk_zzmm: "",
        zwk_zyks: "",
        zknum: "",
        is_tiaoji: 0,
        zwk_xitong: "",
        zwk_zwmj: "",
        zwk_zhiweidaima: "",
        leixing: "",
        orderway: "desc",
        list: [],
        jcnxList: ["不限", "一年", "二年", "三年", "五年及以上"],
        zzmmList: ["不限", "共青团员", "中共党员"],
        zhunayeList: ["是", "否"],
        xwList: ["无要求", "学士", "硕士", "博士", "与最高学历相对应的学位"],
        collectNum: 0,
        barGoBack: !1,
        goZy: 0,
        jobArr: [],
        majorArr: [],
        channel: ""
    },
    didaogao: function () {
        var _ = this;
        console.log()
        var arr = _.data.list
        console.log(arr)
        var brr = arr.sort(_.compare("zongchengjizuidifen", true));
        console.log(brr)

        _.setData({
            list: brr,
            lock: !0,
            showEdu: !1,
            shadow: !1,
        })
    },
    gaodaodi: function () {
        var _ = this;
        console.log()
        var arr = _.data.list
        console.log(arr)
        var brr = arr.sort(_.compare("zongchengjizuidifen", false));
        console.log(brr)
        _.setData({
            list: brr,
            lock: !0,
            showEdu: !1,
            shadow: !1
        })
    },

    didaogao1: function () {
        var _ = this;
        console.log('1')
        var arr = _.data.list
        console.log(arr)
        var brr
        var nianfen = arr[0].nianfen;
        if (nianfen == 2021) {
            brr = arr.sort(_.compare1("siritongguo", true));
        } else if (nianfen == 2020) {
            brr = arr.sort(_.compare1("liuritongguo", true));
        } else {
            brr = arr.sort(_.compare1("wuritongguo", true));
        }
        _.setData({
            list: brr,
            lock: !0,
            showEdu1: !1,
            shadow: !1,
        })
    },
    gaodaodi1: function () {
        var _ = this;
        console.log('2')
        var arr = _.data.list
        console.log(arr[0].nianfen)
        var nianfen = arr[0].nianfen;
        if (nianfen == 2021) {
            var brr = arr.sort(_.compare1("siritongguo", false));
        } else if (nianfen == 2020) {
            var brr = arr.sort(_.compare1("liuritongguo", false));
        } else {
            var brr = arr.sort(_.compare1("wuritongguo", false));
        }

        console.log(brr)
        _.setData({
            list: brr,
            lock: !0,
            showEdu1: !1,
            shadow: !1
        })
    },
    to1: function () {
        wx.navigateToMiniProgram({
            appId: 'wx3dec2f3a28471026', //小程序appid
            path: 'pages/share-login/share-login?minicodeid=646362', //跳转关联小程序app.json配置里面的地址
            //**重点**要打开的小程序版本，有效值 develop（开发版），trial（体验版），release（正式版） 
            envVersion: 'release',
            success(res) {
                console.log('打开成功！')
            }
        })
    },
    to2: function () {
        wx.navigateToMiniProgram({
            appId: 'wxca86930ec3e80717', //小程序appid
            path: 'page/course/details?fenxiang=1&id=245116&scode=mDYx3', //跳转关联小程序app.json配置里面的地址
            //**重点**要打开的小程序版本，有效值 develop（开发版），trial（体验版），release（正式版） 
            envVersion: 'release',
            success(res) {
                console.log('打开成功！')
            }
        })
    },
    to3: function () {
        wx.navigateToMiniProgram({
            appId: 'wxca86930ec3e80717', //小程序appid
            path: 'page/course/details?fenxiang=1&id=316456&scode=mDYx3', //跳转关联小程序app.json配置里面的地址
            //**重点**要打开的小程序版本，有效值 develop（开发版），trial（体验版），release（正式版） 
            envVersion: 'release',
            success(res) {
                console.log('打开成功！')
            }
        })
    },
    swiperChange: function (t) {
        var e = t.detail,
            n = e.current,
            r = e.source;
        "autoplay" !== r && "touch" !== r || this.setData({
            current: n
        });
    },

    onShow: function () {
        var t = this;
        this.chooseJob01(), wx.getStorageSync("collectNum") && t.setData({
            collectNum: wx.getStorageSync("collectNum")
        });
    },
    onLoad: function (o) {
        var n = this,
            r = this;
        if (o.channel && (i.registerApp({
                data_source: o.channel
            }), this.setData({
                channel: o.channel
            })), s = new a({
                key: "Z3HBZ-VX3CP-PQVDI-LMW43-7PQB6-SWFFE"
            }), 
            wx.getLocation({
                type: "wgs84",
                isHighAccuracy: !0,
                success: function (t) {
                    console.log(t)
                    wx.setStorageSync("latitude", t.latitude), wx.setStorageSync("longitude", t.longitude),
                        r.getLocal(t.latitude, t.longitude), i.registerApp({
                            $latitude: wx.getStorageSync("latitude") ? 1e6 * wx.getStorageSync("latitude") : "",
                            $longitude: wx.getStorageSync("longitude") ? 1e6 * wx.getStorageSync("longitude") : ""
                        });
                },
                fail: function () {
                    wx.getStorageSync("pos_choose") || (r.setData({
                        location: "济南"
                    }), wx.setStorageSync("city", "济南"));
                }
            }), 1 == o.is_tiaoji && this.setData({
                is_tiaoji: 1,
                tiaoji: !0
            }), o.zwk_diqu) {
            var d;
            this.setData((d = {
                zwk_sheng: o.zwk_sheng,
                zwk_diqu: o.zwk_diqu,
                zwk_bmmc: o.zwk_bmmc,
                zwk_zwmj: o.zwk_zwmj,
                zwk_zhiweidaima: o.zwk_zhiweidaima
            }, t(d, "zwk_sheng", o.zwk_sheng), t(d, "goZy", 1), d));
        }

        var u = this;
        wx.request({
            url: e.globalData.request_url + "api/zhiweiku/gk/getTiaoji.php",
            method: "POST",
            data: {},
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function (t) {
                console.log(t)
                u.setData({
                    tiaoji: !0
                });
            }
        }), wx.createSelectorQuery().select(".nav_edu").boundingClientRect(function (t) {
            u.setData({
                eduHeight: t.height,
                location: wx.getStorageSync("city")
            });
        }).exec(), wx.createSelectorQuery().select(".nav_major").boundingClientRect(function (t) {
            u.setData({
                majorHeight: t.height
            });
        }).exec(), wx.createSelectorQuery().select(".topHeight").boundingClientRect(function (t) {
            u.setData({
                topHeight: t.height
            });
        }).exec(), wx.login({
            success: function (t) {

                if ("login:ok" == t.errMsg) var a = t.code;
                a && wx.request({
                    url: e.globalData.request_url + "api/zhiweiku/getUserInfo.php",
                    method: "POST",
                    data: {
                        code: a,
                        province: "国家",
                        channel: r.data.channel
                    },
                    header: {
                        "content-type": "application/x-www-form-urlencoded"
                    },
                    success: function (t) {
                        console.log(t)
                        200 == t.data.code && r.setData({
                            session_key: t.data.session_key,
                            openId: t.data.openid,
                            uid: t.data.uid
                        });
                    }
                });
            }
        });
        var h = wx.getStorageSync("hasUserInfo"),
            w = wx.getStorageSync("phone");
        h || w || r.setData({
            goLogin: !0
        }), e.globalData.userInfo ? this.setData({
            userInfo: e.globalData.userInfo,
            hasUserInfo: !0
        }) : this.data.canIUse ? e.userInfoReadyCallback = function (t) {
            n.setData({
                userInfo: t.userInfo,
                hasUserInfo: !0
            });
        } : wx.getUserInfo({
            success: function (t) {
                e.globalData.userInfo = t.userInfo, n.setData({
                    userInfo: t.userInfo,
                    hasUserInfo: !0
                });
            }
        });
    },
    compare: function (property, desc) {
        return function (a, b) {
            var value1 = a[property];
            var value2 = b[property];
            if (desc == true) {
                // 升序排列
                return value1 - value2;
            } else {
                // 降序排列
                return value2 - value1;
            }
        }
    },
    compare1: function (property, desc) {
        return function (a, b) {
            var value1 = a[property].replace("+", "");
            var value2 = b[property].replace("+", "");
            if (desc == true) {
                // 升序排列
                if (value1 == '3-') {
                    value1 = 2
                } else if (value2 == '3-') {
                    value2 = 2
                }
                return value1 - value2;
            } else {
                // 降序排列
                return value2 - value1;
            }
        }
    },
    getList: function (t) {
        var a = this;
        var phone = wx.getStorageSync('phone')
        console.log(phone)
        if (1 != this.data.flag) return !1;
        this.setData({
            flag: !1
        }), this.data.success && wx.showLoading({
            title: "加载中"
        }), wx.request({
            url: "https://zg99.offcn.com/index/chaxun/getfylist/?actid=43723&callback=?",
            method: "get",
            data: {
                phone: phone,
                nianfen: a.data.nianfen,
                page: a.data.page,
                dishi: a.data.location,
                limits: 20,
            },

            success: function (e) {
                var jsonStr = e.data;
                jsonStr = jsonStr.replace("(", "");
                jsonStr = jsonStr.replace(")", "");
                if (typeof jsonStr != 'object') {
                    jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
                    var theJson = JSON.parse(jsonStr);
                };
                console.log(theJson)

                if (theJson.status == 1) {
                    t ? a.setData({
                        list: a.data.list.concat(theJson.lists)
                    }) : a.setData({
                        list: theJson.lists
                    }), 1 == theJson.status ? a.setData({
                        page: Number(theJson.page),
                        total: theJson.zcounts,
                    }) : 2 == theJson.status && a.setData({
                        msg: theJson.msg,
                    })
                } else {
                    wx.showToast({
                        title: '暂无此职位数据',
                    })
                }




            },
            fail: function () {
                a.data.success && wx.hideLoading(), a.setData({
                    flag: !0,
                    success: !0
                });
            },
            complete: function () {
                a.data.success && wx.hideLoading(), a.setData({
                    flag: !0,
                    success: !0
                });
            }
        });
    },
    lower: function () {
        1 != this.data.over && (this.setData({
            page: this.data.page + 1,
            flag: !0
        }), this.getList(!0));
    },
    changeRegion: function () {
        this.setData({
            layer: !1,
            show_tab_bar: !1
        }), this.closeLayer();
    },
    transfer: function (t) {
        var e = t.currentTarget.dataset.letter;
        this.setData({
            toView: e
        });
    },
    replaceRegion: function (t) {
        var e = t.currentTarget.dataset.value;
        // if ("澳门" == e || "香港" == e || "台湾" == e) return wx.showToast({
        //     title: "该地区没有数据，请换个地区吧~",
        //     icon: "none"
        // }), !1;
        this.setData({
                location: e,
                layer: !0,
                zwk_sheng: wx.setStorageSync("city", e)
            }), wx.setStorageSync("pos_choose", "true"), this.getList(), this.chooseJob01(),
            this.setData({
                scrollTop: 95,
                show_tab_bar: !0
            });
    },
    closeProvSelect: function () {
        this.setData({
            layer: !0,
            show_tab_bar: !0
        });
    },
    onShareAppMessage: function () {
        return {
            title: "省考小助手",
            path: "/pages/index/index"
        };
    },
    closeLayer: function () {
        this.setData({
            lock: !0,
            shadow: !1,
            showJob: !1,
            showEdu: !1,
            showMajor: !1,
            showMore: !1,
            fixedbar: !1
        });
    },
    bindEdu: function () {
        if (this.data.showEdu) return this.setData({
            showEdu: !1,
            shadow: !1,
            top: "top",
            lock: !0
        }), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), !1;
        this.setData({
            shadow: !0,
            showEdu: !0,
            showMajor: !1,
            showJob: !1,
            showMore: !1,
            top: "top",
            lock: !1,
            fixedbar: !0
        });
    },
    choose_edu: function (t) {
        var e = t.currentTarget.dataset.text,
            a = t.currentTarget.dataset.index;
        console.log(e)
        console.log(a)

        this.setData({
            eduIndex: a,
            xueli: e,
            edu: e
        }), this.setData({
            lock: !0,
            showEdu: !1,
            shadow: !1
        }), this.setData({
            scrollTop: 95
        }), this.getList();
    },
    bindEdu1: function () {
        if (this.data.showEdu1) return this.setData({
            showEdu1: !1,
            shadow: !1,
            top: "top",
            lock: !0
        }), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), !1;
        this.setData({
            shadow: !0,
            showEdu1: !0,
            showMajor: !1,
            showJob: !1,
            showMore: !1,
            top: "top",
            lock: !1,
            fixedbar: !0
        });
    },
    choose_edu1: function (t) {
        var e = t.currentTarget.dataset.text,
            a = t.currentTarget.dataset.index;
        console.log(e)
        console.log(a)

        this.setData({
            eduIndex1: a,
            xueli: e,
            edu1: e
        }), this.setData({
            lock: !0,
            showEdu1: !1,
            shadow: !1
        }), this.setData({
            scrollTop: 95
        }), this.getList();
    },

    bindnianfen: function () {
        if (this.data.shownianfen) return this.setData({
            shownianfen: !1,
            shadow: !1,
            top: "top",
            lock: !0
        }), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), !1;
        this.setData({
            shadow: !0,
            shownianfen: !0,
            showMajor: !1,
            showJob: !1,
            showMore: !1,
            top: "top",
            lock: !1,
            fixedbar: !0
        });
    },
    choose_nianfen: function (t) {
        var e = t.currentTarget.dataset.text,
            a = t.currentTarget.dataset.index;
        console.log(e)
        console.log(a)

        this.setData({
            nianfenIndex: a,
            nianfen: e
        }), this.setData({
            lock: !0,
            shownianfen: !1,
            shadow: !1
        }), this.setData({
            scrollTop: 95
        }), this.getList();
    },


    bindMore: function () {
        if (this.data.showMore) return this.setData({
            shadow: !1,
            showMore: !1,
            lock: !0
        }), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), !1;
        this.setData({
            shadow: !0,
            showMore: !0,
            showMajor: !1,
            showEdu: !1,
            showJob: !1,
            top: "top",
            lock: !1,
            fixedbar: !0
        });
    },
    moreReset: function () {
        this.setData({
            xwId: null,
            jcnxId: null,
            zzmmId: null,
            zynlId: null,
            xuewei: "",
            zwk_jcnx: "",
            zwk_zzmm: "",
            zwk_zyks: "",
            zknum: ""
        }), this.getList(), this.setData({
            fixedbar: !0
        });
    },
    moreSure: function () {
        this.getList(), this.closeLayer(), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), this.setData({
            scrollTop: 95
        });
    },
    xuewei: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        if (e == this.data.xwId) return this.setData({
            xwId: null,
            xuewei: ""
        }), !1;
        this.setData({
            xwId: e,
            xuewei: a
        });
    },
    jcnx: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        if (e == this.data.jcnxId) return this.setData({
            jcnxId: null,
            zwk_jcnx: ""
        }), !1;
        this.setData({
            jcnxId: e,
            zwk_jcnx: a
        });
    },
    zzmm: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        if (e == this.data.zzmmId) return this.setData({
            zzmmId: null,
            zwk_zzmm: ""
        }), !1;
        this.setData({
            zzmmId: e,
            zwk_zzmm: a
        });
    },
    zynl: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        if (e == this.data.zynlId) return this.setData({
            zynlId: null,
            zwk_zyks: ""
        }), !1;
        this.setData({
            zynlId: e,
            zwk_zyks: a
        });
    },

    bindscroll: function (t) {
        t.detail.scrollTop > 80 ? this.setData({
            fixedbar: !0
        }) : this.setData({
            fixedbar: !1
        }), t.detail.scrollTop > 300 ? this.setData({
            barGoBack: !0
        }) : this.setData({
            barGoBack: !1
        });
    },
    go_jobInfo: function (t) {
        var e = t.currentTarget.dataset.zdy,
            a = t.currentTarget.dataset.index,
            i = this.data.list;
        i[a].zwk_jishu++, this.setData({
            list: i
        }), wx.navigateTo({
            url: "../jobInfo/jobInfo?zdy=" + e
        });
    },
    tohz: function () {
        wx.navigateToMiniProgram({
            appId: 'wx24657d455969c6ae', //小程序appid
            path: 'pages/index/index', //跳转关联小程序app.json配置里面的地址
            //**重点**要打开的小程序版本，有效值 develop（开发版），trial（体验版），release（正式版） 
            envVersion: 'release',
            success(res) {
                console.log('打开成功！')
            }
        })
    },
    tofh: function () {
        wx.navigateToMiniProgram({
            appId: 'wxca86930ec3e80717', //小程序appid
            path: 'page/course/details?fenxiang=1&id=193652', //跳转关联小程序app.json配置里面的地址
            //有效值 develop（开发版），trial（体验版），release（正式版） 
            envVersion: 'release',
            success(res) {
                console.log('打开成功！')
            }
        })
    },

    chooseJob01: function () {
        var t = this;
        wx.request({
            url: e.globalData.request_url + "api/zhiweiku/gk/getSelect.php",
            method: "POST",
            data: {
                act: "getFenlei",
                zwk_sheng: wx.getStorageSync("position"),
                zwk_diqu: ""
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function (e) {
                200 == e.data.code && (e.data.extra && t.setData({
                    leixing: e.data.extra.fieldE
                }), t.setData({
                    job_list01: e.data.data,
                    jid01: e.data.data[0]
                }), t.getList(), t.chooseJob02(e.data.data[0]));
            }
        });
    },
    getJobChildren01: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        this.setData({
            jidActive01: e,
            jidActive02: 0,
            jid01: a,
            jobArr: []
        }), this.chooseJob02(a);
    },
    chooseJob02: function (t) {
        var a = this;
        wx.request({
            url: e.globalData.request_url + "api/zhiweiku/gk/getSelect.php",
            method: "POST",
            data: {
                act: "getBumen",
                zwk_sheng: wx.getStorageSync("position"),
                zwk_diqu: "",
                zwk_fenlei: t,
                leixing: a.data.leixing
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function (e) {
                200 == e.data.code && (a.setData({
                    job_list02: e.data.data,
                    jid02: e.data.data[0]
                }), a.chooseJob03(t, e.data.data[0]));
            }
        });
    },
    getJobChildren02: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        this.setData({
            jidActive02: e,
            jid02: a,
            jobArr: []
        }), this.chooseJob03(this.data.jid01, a);
    },
    chooseJob03: function (t, a) {
        var i = this,
            s = this.data.jobArr;
        wx.request({
            url: e.globalData.request_url + "api/zhiweiku/gk/getSelect.php",
            method: "POST",
            data: {
                act: "getYrsj",
                zwk_sheng: wx.getStorageSync("position"),
                zwk_diqu: "",
                zwk_fenlei: t,
                zwk_bmmc: a,
                leixing: i.data.leixing
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function (t) {
                200 == t.data.code && (t.data.data[0].select = !0, s.push(t.data.data[0].zwk_yrsj),
                    i.setData({
                        job_list03: t.data.data,
                        jid03: t.data.data[0].zwk_yrsj,
                        jobArr: s
                    }));
            }
        });
    },
    getJobChildren03: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val,
            i = this.data.job_list03,
            s = this.data.jobArr;
        1 != i[e].select ? (i[e].select = !0, s.push(a)) : (i[e].select = !1, s.splice(e, 1)),
            this.setData({
                job_list03: i,
                jobArr: s,
                jid03: s
            });
    },
    job_reset: function () {
        for (var t = this.data.job_list03, e = 0; e < t.length; e++) t[e].select = !1;
        this.setData({
            jid01: "",
            jid02: "",
            jid03: "",
            jobArr: [],
            jidActive01: null,
            jidActive02: null,
            jidActive03: null,
            zwk_fenlei: "",
            zwk_bmmc: "",
            zwk_yrsj: "",
            job_list03: t
        }), this.getList(), this.setData({
            fixedbar: !0
        });
    },

    bindMajor: function () {
        this.data.showMajor ? (this.setData({
            showMajor: !1,
            shadow: !1,
            top: "top",
            lock: !0
        }), this.data.list.length < 1 && this.setData({
            fixedbar: !1
        }), !1) : void this.setData({
            shadow: !0,
            showMajor: !0,
            showEdu: !1,
            showJob: !1,
            showMore: !1,
            top: "top",
            lock: !1,
            fixedbar: !0
        });
        this.chooseMajor01()
    },
    chooseMajor01: function (t, a) {
        var i = this;
        i.setData({
            major_list01: ['本科', '专科', '研究生']
        })
        wx.request({
            url: "https://tgadmin.sdwx.zgkfpt.cn/api/v1/get_major_list",
            method: "GET",
            data: {
                edu_type: 0
            },
            success: function (e) {
                console.log(e.data.list[0].edu_type)
                var a = e.data.list[0].edu_type
                i.chooseMajor02(a);
            }
        });
    },
    getChildren01: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val;
        this.setData({
            theEdu: e,
            midActive01: e,
            midActive02: 0,
            mid01: a,
            majorArr: []
        }), this.chooseMajor02(e);
    },
    chooseMajor02: function (t) {
        var i = this;
        wx.request({
            url: "https://tgadmin.sdwx.zgkfpt.cn/api/v1/get_major_list",
            method: "GET",
            data: {
                edu_type: t
            },
            success: (e) => {
                console.log(e.data.list[0].id)
                i.setData({
                    major_list02: e.data.list,
                })
                var a = e.data.list[0].id
                i.chooseMajor03(a, 0);
            }
        });
    },
    getChildren02: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val,
            id = t.currentTarget.dataset.id;
        this.setData({
            mid02: a,
            midActive02: e,
            majorArr: [],
            theDl: a
        });
        var a = this.data.midActive01;
        this.chooseMajor03(id, a);
    },
    chooseMajor03: function (t, a) {
        var i = this,
            s = this.data.majorArr;
        wx.request({
            url: "https://tgadmin.sdwx.zgkfpt.cn/api/v1/get_major_list",
            method: "GET",
            data: {
                edu_type: this.data.theEdu,
                type: 2,
                major_type_id: t
            },
            success: function (t) {
                console.log(t.data.list)
                i.setData({
                    major_list03: t.data.list,
                });
            }
        });
    },
    getChildren03: function (t) {
        var e = t.currentTarget.dataset.index,
            a = t.currentTarget.dataset.val,
            i = this.data.major_list03,
            s = this.data.majorArr;
        // 1 != i[e].select ? (i[e].select = !0, s.push(a)) : (i[e].select = !1, s.splice(e, 1)),
        this.setData({
            midActive03: e,
            mid03: s,
            majorArr: s,
            major_list03: i,
            theZy: a
        });
    },
    chooseMajor: function () {


        this.setData({
            zhuanye: this.data.theZy,
            scrollTop: 95
        })

        this.closeLayer(), this.getList()

        console.log(this.data.zhuanye)
        // this.setData({
        //     zhuanye: this.data.theZy,
        //     page: 1
        // }), this.closeLayer(), this.getList(), this.data.list.length < 1 && this.setData({
        //     fixedbar: !1
        // }), this.setData({
        //     scrollTop: 95
        // });
    },
    major_reset: function () {
        for (var t = this.data.major_list03, e = 0; e < t.length; e++) t[e].select = !1;
        this.setData({
            mid01: "",
            mid02: "",
            mid03: "",
            majorArr: [],
            midActive01: null,
            midActive02: null,
            midActive03: null,
            major_list03: t
        }), this.getList(), this.setData({
            fixedbar: !0
        });
    },
    addJob: function (t) {
        var a = this,
            i = t.currentTarget.dataset.id,
            s = this.data.list,
            o = t.currentTarget.dataset.index;

        function objFn(obj, objIndex, objs) {
            return obj.id == i;
        }
        var index = s.findIndex(objFn);
        console.log(s[index]);
        a.data.faver.push(s[index]);
        wx.setStorageSync('faver', a.data.faver)

        db.collection('userfav').add({
            data: {
                count: s[index]
            },
            success: res => {
                console.log('[数据库] [新增记录] 成功，记录 _id: ', res._id)
                wx.showToast({
                    title: "添加成功",
                    icon: "none"
                }), s[o].storage_status = 1, a.setData({
                    list: s
                }), wx.setStorageSync("collectNum", a.data.collectNum + 1), a.setData({
                    collectNum: wx.getStorageSync("collectNum")
                })
            },
            fail: err => {
                console.error('[数据库] [新增记录] 失败：', err)
            }
        })


    },
    delJob: function (t) {
        var a = this,
            i = t.currentTarget.dataset.id,
            s = this.data.list,
            o = t.currentTarget.dataset.index;
        wx.request({
            url: e.globalData.request_url + "api/zhiweiku/gk/getCollect.php",
            method: "POST",
            data: {
                act: "del_collect",
                openid: wx.getStorageSync("openId"),
                id: i
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function (t) {
                200 == t.data.code ? (s[o].storage_status = 0, wx.getStorageSync("collectNum") <= 0 ? (wx.setStorageSync("collectNum", 0),
                    a.setData({
                        collectNum: wx.getStorageSync("collectNum")
                    })) : (wx.setStorageSync("collectNum", a.data.collectNum - 1), a.setData({
                    collectNum: wx.getStorageSync("collectNum")
                })), a.setData({
                    list: s
                }), wx.showToast({
                    title: "取消成功",
                    icon: "none"
                })) : wx.showToast({
                    title: t.data.msg,
                    icon: "none"
                });
            }
        });
    },
    toother: function () {
        wx.navigateTo({
            url: '../../othersearch/othersearch',
        })
    },
    watchInput: function (t) {
        "" == t.detail.value && (this.setData({
            keyword: ""
        }), this.getList());
    },
    search: function (t) {
        var e = t.detail.value;
        if ("" == e) return wx.showToast({
            title: "请输入专业名称",
            icon: "none"
        }), !1;
        this.setData({
            keyword: e
        }), this.getList();
    },

    clear_collect: function () {
        wx.setStorageSync("collectNum", 0), this.setData({
            collectNum: wx.getStorageSync("collectNum")
        }), wx.navigateTo({
            url: "../myJob/myJob"
        });
    },
    backTop: function () {
        this.setData({
            scrollTop: 0
        });
    },
    barGoBack: function (t) {
        this.backTop();
    },
    getLocal: function (t, e) {
        var a = this;
        s.reverseGeocoder({
            location: {
                latitude: t,
                longitude: e
            },
            success: function (t) {
                var e = t.result.ad_info.province.replace("市", ""),
                    i = t.result.ad_info.city.replace("市", "");
                e = (e = (e = (e = (e = (e = e.replace("省", "")).replace("壮族自治区", "")).replace("回族自治区", "")).replace("维吾尔自治区", "")).replace("自治区", "")).replace("特别行政区", ""),
                    console.log(e);
                console.log(i);
                if (e != '山东') {
                    a.setData({
                        location: '省属'
                    });
                } else {
                    wx.setStorageSync("position", e), wx.setStorageSync("city", i), a.setData({
                        location: i
                    });
                }

            },
            fail: function (t) {
                console.log(t);
            }
        });
    },
    getPhoneNumber: function (t) {
        var a = this,
            s = t.currentTarget.dataset.url;
        "getPhoneNumber:ok" == t.detail.errMsg && wx.request({
            url: e.globalData.request_url + "api/zhiweiku/getSelf.php",
            data: {
                encryptedData: t.detail.encryptedData,
                iv: t.detail.iv,
                sessionKey: a.data.session_key,
                act: "up_mobile",
                province: "国家",
                uid: a.data.uid
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            method: "post",
            success: function (t) {
                wx.setStorageSync("hasUserInfo", "1"), wx.setStorageSync("openId", a.data.openId),
                    wx.setStorageSync("phone", t.data.phoneNumber), i.login(t.data.phoneNumber), a.setData({
                        goLogin: !1
                    }), s && wx.navigateTo({
                        url: s
                    });
            },
            fail: function () {
                a.wxlogin();
            }
        }), "getPhoneNumber:fail user deny" == t.detail.errMsg && wx.showModal({
            title: "提示",
            content: "为了更好的用户体验请先授权"
        });
    }
});